package com.example.service.posthandler;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanPostProcessor;
import org.springframework.stereotype.Component;
import org.springframework.web.filter.RequestContextFilter;
import org.springframework.web.servlet.DispatcherServlet;

/**
 * @author long
 * @date 2025/6/20 13:24
 */
@Component
public class RequestAttrBeanPostProcessor implements BeanPostProcessor {

    @Override
    public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
        if(bean instanceof DispatcherServlet){
            DispatcherServlet filter = (DispatcherServlet)bean;
            filter.setThreadContextInheritable(true);
        }
        return bean;
    }

}
